using System;
using System.Xml;
//+
namespace General.Xml
{
    public static class XPathProcessor
    {
        //- ~GetNode -//
        internal static XmlNode GetNode(XmlDocument doc, String xpath)
        {
            if (doc != null && doc.DocumentElement != null)
            {
                XmlNode node = doc.DocumentElement.SelectSingleNode(xpath);
                return node;
            }
            //+
            return null;
        }

        //- ~GetString -//
        internal static String GetString(XmlDocument doc, String xpath)
        {
            if (doc != null && doc.DocumentElement != null)
            {
                XmlNode node = doc.DocumentElement.SelectSingleNode(xpath);
                if (node != null)
                {
                    return node.InnerXml;
                }
            }
            //+
            return String.Empty;
        }
    }
}